{% extends 'base page.html' %}
{% block title %}
    用户管理
{% endblock %}

{% block content %}
    {# 内容部分 #}

    <div class="container">
        {# 新建按钮 #}
        <div style="margin-bottom: 10px">
            {# 点击新建，跳转到添加页面，覆盖当前标签页 #}
            <a class="btn btn-primary" href="/员工管理/添加员工">
                {# 新建部门按钮文字和图标 #}
                <span class="glyphicon glyphicon-plus-sign" aria-hidden="true"></span>
                新建员工
            </a>

            <div style="float: right;width: 300px">
                <form method="get">
                    <div class="input-group">
                        <input type="text" name="search_value" class="form-control" placeholder="搜索...">
                        <span class="input-group-btn">
                            <button class="btn btn-default" type="submit">
                                <span class="glyphicon glyphicon-search" aria-hidden="true"></span>
                            </button>
                        </span>
                    </div>
                </form>
            </div>

        </div>

        {# 面板 #}
        <div class="panel panel-default">
            <div class="panel-heading">
                {# 列表图标和文字 #}
                <span class="glyphicon glyphicon-th-list" aria-hidden="true"></span>
                用户列表
            </div>

            {# 表格 #}
            <table class="table table-bordered">
                {# 表头 #}
                <thead>
                <tr>
                    <th>编号</th>
                    {% for field in form %}
                        <th>{{ field.label }}</th>
                        {% if field.label == "入职时间" %}
                            <th>部门编号</th>
                        {% endif %}
                    {% endfor %}
                    <th>操作</th>
                </tr>
                </thead>
                {# 表身 #}
                <tbody>

                {% for info in all_user_info %}
                    <tr>
                        <td>{{ info.id }}</td>
                        <td>{{ info.name }}</td>
                        <td>{{ info.age }}</td>
                        <td>{{ info.get_gender_display }}</td>
                        <td>{{ info.password }}</td>
                        <td>{{ info.account }}</td>
                        <td>{{ info.create_time|date:"Y-m-d" }}</td>
                        <td>{{ info.department.id }}</td>
                        <td>{{ info.department.industry_title }}</td>
                        <td>
                            <a class="btn btn-primary btn-xs" href="/员工管理/{{ info.id }}/编辑员工/">编辑</a>
                            <a class="btn btn-danger btn-xs"
                               href="/员工管理/删除员工?employee_id={{ info.id }}#">删除</a>
                        </td>
                    </tr>
                {% endfor %}

                </tbody>
            </table>
        </div>

        <ul class="pagination">
            {{ page_str }}
        </ul>
    </div>

{% endblock %}
